package ca.kooki.codesnippet.views;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;

import ca.kooki.codesnippet.Activator;
import ca.kooki.codesnippet.InMemoryCodeSnippetRepository;

public class SwtTest {

  public Shell parent;
  public static Display display;
  
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    display = new Display();
  }

  @Before
  public void setUp() throws Exception {
    parent = new Shell(display);
    Activator.loadDefaultAsRequired();
  }
  
  @After
  public void tearDown() throws Exception {
    parent.dispose();
    Activator.resetDefault();
    InMemoryCodeSnippetRepository.resetDefault();
  }
  
  @AfterClass
  public static void tearDownAfterClass() throws Exception {
    display.dispose();
  }

}
